
export const chartOption = (chartData: any) => {

    const option = {
        backgroundColor: '#1b2735',
        xAxis: {
            show: false
        },
        yAxis: [{
            show: true,
            data: chartData.yData,
            inverse: true,
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                color: '#fff',
                formatter: function (value: any, index: number) {
                    return [
                        '{lg|' + (index + 1) + '}' + '{title|' + value + '} '
                    ].join('\n')
                },
                rich: {
                    lg: {
                        backgroundColor: '#339911',
                        color: '#fff',
                        borderRadius: 15,
                        // padding: 5,
                        align: 'center',
                        width: 15,
                        height: 15
                    },
                }
            },


        }, {
            show: true,
            inverse: true,
            data: chartData.labelData,
            axisLabel: {
                textStyle: {
                    fontSize: 12,
                    color: '#fff',
                },
            },
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            },
            axisTick: {
                show: false
            },

        }],
        series: [{
            name: '条',
            type: 'bar',
            yAxisIndex: 0,
            data: chartData.xData,
            barWidth: 30,
            itemStyle: {
                normal: {
                    barBorderRadius: 30,
                    color: function (params: any) {
                        var num = chartData.colorList.length;
                        return chartData.colorList[params.dataIndex % num]
                    },
                }
            },
            label: {
                normal: {
                    show: true,
                    position: 'inside',
                    formatter: '{c}%'
                }
            },
        }, {
            name: '框',
            type: 'bar',
            yAxisIndex: 1,
            barGap: '-100%',
            data: [100, 100, 100, 100, 100],
            barWidth: 40,
            itemStyle: {
                normal: {
                    color: 'none',
                    borderColor: '#00c1de',
                    borderWidth: 3,
                    barBorderRadius: 15,
                }
            }
        },]
    };

    return option
}